﻿
@{
    ViewBag.Title = "文件管理";
}

<div class="row col-md-12 ml-0" style="min-height:5vh;">
    <strong class="font-rfs" style="margin-right: 2rem;padding-top: 0.4rem;">文件管理</strong>
</div>
<div class="row col-md-12 ml-0 pre-scrollable" style="min-height:90vh;">
    <div class="table-responsive-sm shadow p-0 bg-white rounded col-md-2" style="min-height:90vh;">
        <div class="row col-md-12 tab-content" style="padding-left: 0;padding-right: 0px;right: -15px;min-height: 3vh;">
            <ul class="nav col-md-12" style="padding-right: 0;margin-bottom: 1px;">
                <li id="li-tabWikiList" class="tabButton col-md-5 tab-first-active font-rfs" style="text-align:center;padding-left: 1px;padding-right: 1px;" data-active="true">
                    <a id="a-tabWikiList" href="#tabUserList" data-toggle="tab" class="text-decoration-none" style="display: inline-block;width:100%;">文件目录</a>
                </li>
                <li class="col-md-7 tab-Notactive" style="text-align: center;"><a href="" data-toggle="tab"></a></li>
            </ul>
        </div>
        <div class="row col-md-12 tab-content tab-body" style="padding-right: 0px;right: -15px;padding-left: 0px;top: -2px;min-height: 87vh;">
            <div class="col-md-12 ml-0 mr-0 tab-pane active" id="tabAnalyte" style="padding-left: 0px;padding-right: 0px;overflow-x:auto;overflow-y:auto;">
                <div class="row col-md-12" style="margin-bottom: 5px; min-height:3vh;">
                    <button id="WikiFManager-AddTopDirectory" class="btn btn-rfs" title="添加文件分类"><i class="bi-briefcase" style="color:#007bff"></i> 分类</button>
                    <button id="WikiFManager-AddDirectory" class="btn btn-rfs" title="添加目录"><i class="bi-folder-plus" style="color:#007bff"></i> 目录</button>
                </div>
                <div class="col-md-12" style="padding-left: 5px;padding-right: 5px;">
                    <ul id="WikiTree" class="nav navbar-nav font-rfs">
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="row rounded col-md-10 ml-1">
        <div class="row col-md-12 tab-content" style="padding-left: 0;padding-right: 0px;right: -15px;min-height: 3vh;">
            <ul class="nav col-md-12" style="padding-right: 0;margin-bottom: 1px;">
                <li id="li-tabPageContent" class="tabButton col-md-1 tab-first-active font-rfs" style="text-align:center;padding-left: 1px;padding-right: 1px;" data-active="true">
                    <a id="a-tabPageInfo" href="#tabPageInfo" data-toggle="tab" class="text-decoration-none" style="display: inline-block;width:100%;">文件列表</a>
                </li>
                <li class="col-md-11 tab-Notactive" style="text-align: center;"><a href="" data-toggle="tab"></a></li>
            </ul>
        </div>
        <div class="row col-md-12 tab-content tab-body" style="padding-right: 0px;right: -15px;padding-left: 0px;top: -2px;min-height: 87vh;">
            <div class="row col-md-12" style="margin-bottom: 5px; min-height:3vh;">
                <button id="WikiFManager-AddFile" class="btn btn-rfs" title="添加文件"><i class="bi-file-earmark-plus" style="color:#007bff"></i> 添加</button>
                <button id="WikiFManager-delFile" class="btn btn-rfs"><i class="bi-trash"></i> 删除</button>
            </div>
            <div class="col-md-12 ml-0 mr-0 tab-pane active" id="tabPageInfo" style="padding-left: 0px;padding-right: 0px;min-height: 80vh;height:81vh;">
                <div class="table-responsive-sm p-0 bg-white rounded col-md-12 pre-scrollable" style="height:87vh;overflow-x:auto;overflow-y:auto">
                    <table id="tabFile" class="table table-striped table-bordered table-sm table-hover">
                        <thead>
                            <tr>
                                <th>Id</th>
                                <th>文件名</th>
                                <th>编号</th>
                                <th>年份</th>
                                <th>版本</th>
                                <th>修订次数</th>
                                <th>编制人</th>
                                <th>编制日期</th>
                                <th>生效日期</th>
                                <th>创建人</th>
                                <th>创建日期</th>
                                <th>备注</th>
                                <th>文件</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal" id="WikiFManager-Modal" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class='modal-header'>
                <p id="WikiFManager-Modal-Title" class="pt-3 pl-3 font-rfs"></p>
                <a data-dismiss="modal" class="modal-close">&times;</a>
            </div>
            <div class="modal-body">
                <div id="WikiFManager-Modal-AddWiki" style="display:none">
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">文件分类*</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-Modal-WikiName" class="form-control font-rfs border-radius-noleft" placeholder="必填" />
                        </div>
                    </div>
                    <div class="text-right">
                        <button id="WikiFManager-AddTopDirectory-confirm" class="btn btn-primary font-rfs">确定</button>
                        <button id="WikiFManager-AddTopDirectory-cancel" data-dismiss="modal" type="button" class="btn btn-info font-rfs">取消</button>
                    </div>
                </div>
                <div id="WikiFManager-Modal-AddDirectory" style="display:none">
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">当前位置</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddDirectory-Current" class="form-control font-rfs border-radius-noleft" readonly="readonly"/>
                        </div>
                    </div>
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">目录名称*</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddDirectory-Name" class="form-control font-rfs border-radius-noleft" placeholder="必填" />
                        </div>
                    </div>
                    <div class="text-right">
                        <button id="Modal-AddDirectory-confirm" class="btn btn-primary font-rfs">确定</button>
                        <button id="Modal-AddDirectory-cancel" data-dismiss="modal" type="button" class="btn btn-info font-rfs">取消</button>
                    </div>
                </div>
                <div id="WikiFManager-Modal-AddPage" style="display:none">
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">当前位置</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddFile-Current" class="form-control font-rfs border-radius-noleft" readonly="readonly" />
                        </div>
                    </div>
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">文件名*</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddFile-Title" class="form-control font-rfs border-radius-noleft" placeholder="必填" />
                        </div>
                    </div>
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">文件编号</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddFile-FileNumber" class="form-control font-rfs border-radius-noleft" placeholder="必填" />
                        </div>
                    </div>
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">年份</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddFile-Year" class="form-control font-rfs border-radius-noleft" placeholder="必填" />
                        </div>
                    </div>
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">编制人</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddFile-DraftedBy" class="form-control font-rfs border-radius-noleft" placeholder="必填" />
                        </div>
                    </div>
                    <div class="input-group">
                        <div class="col-3 pr-0">
                            <span class="input-group-text font-rfs border-radius-noright noRightBorder">编制时间</span>
                        </div>
                        <div class="col-9 pl-0">
                            <input id="WikiFManager-AddFile-DraftedDate" class="form-control font-rfs border-radius-noleft TimePicker" placeholder="必填" />
                        </div>
                    </div>

                    <div class="text-right">
                        <button id="WikiFManager-AddFile-confirm" class="btn btn-primary font-rfs">确定</button>
                        <button id="WikiFManager-AddFile-cancel" data-dismiss="modal" type="button" class="btn btn-info font-rfs">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal" id="WikiFManager-comModal" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class='modal-header'>
                <p id="WikiFManager-comTitle" class="pt-3 pl-3 font-rfs"></p>
                <a data-dismiss="modal" class="modal-close">&times;</a>
            </div>
            <div class="modal-body">
                <div id="WikiFManager-comEmbed"></div>
            </div>
        </div>
    </div>
</div>
<div class="modal" id="DeleteConfirm-Modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class='modal-header'>
                <p class="pt-3 pl-3 font-rfs">删除文件</p>
                <a data-dismiss="modal" class="modal-close">&times;</a>
            </div>
            <div class="modal-body">
                <p class="font-rfs">删除文件时相关上传文件将一并删除，改操作是不可逆的行为，是否确定删除？</p>
            </div>
            <div class="modal-Delete-footer">
                <button id="DeleteConfirm-Modal-confirm" class="btn btn-outline-primary border-radius-noradius noLeftBorder noRightBorder font-rfs" style="width:50%; height:fit-content">删除</button>
                <button id="cancleDoAbandon" data-dismiss="modal" class="btn btn-outline-primary border-radius-noradius noRightBorder font-rfs" style="width:50%; height:fit-content">取消</button>
            </div>
        </div>
    </div>
</div>

@section Scripts{
    <script>
        var wikiID = "";
        $(document).ready(function () {
            LoadWikis();
            $('.TimePicker').datetimepicker({
                timepicker: false,
                format: "Y/m/d",
                setLocale: 'zh'
            });
        });

        function LoadWikis() {
            $.post("getTopLevel", {
                // 参数
            }, function (list) {
                list.forEach(function (value, index, list) {
                    var re = new RegExp('-','g');
                    $("#WikiTree").append("<li class='nav-item' href='#A" + value.id.replace(re, '') + "' data-toggle='collapse' aria-expanded='false' data-nodeid='" + value.id + "' onclick='Nodeclick(this)'><a><p><i class='bi-briefcase' style='padding-right: 4px;color: #007bff;'></i>" + value.fileName + "</p></a></li>");
                    $("#WikiTree").append("<ul class='collapse list-unstyled' id='A" + value.id.replace(re, '') + "'></ul>");
                });
            });
        };

        function Nodeclick(obj) {
            var re = new RegExp('-','g');
            var nodeid = $(obj).attr('data-nodeid');
            wikiID = nodeid;
            
            $("#WikiTree").find("li").each(function () {
                $(this).removeClass('TreeLiBackColor');
            });
            $(obj).addClass("TreeLiBackColor");
            
            var count = $("#A" + nodeid.replace(re, '')).children('li').length;
            if (count == 0){ // 如果该菜单项没有加载内容就加载，否则不加载。
                $.post("getFileDirectory", {
                    DirectoryId: nodeid
                }, function (list) {
                    var re = new RegExp('-', 'g');
                    var level = list.total;
                    var rows = list.rows;
                    level = level * 0.6;
                    rows.forEach(function (value, index, rows) {
                        $("#A" + wikiID.replace(re, '')).append("<li class='nav-item' href='#A" + value.id.replace(re, '') + "' data-toggle='collapse' aria-expanded='false' data-nodeid='" + value.id + "' onclick='Nodeclick(this)'><a><p style='text-indent: " + level.toString() + "em;margin-bottom: 0.6em;'><i class='bi-folder-plus' style='padding-right: 4px;color: #007bff;'></i>" + value.fileName + "</p></a></li>");
                        $("#A" + wikiID.replace(re, '')).append("<ul class='collapse list-unstyled' id='A" + value.id.replace(re, '') + "'></ul>");
                    });
                });
            }
            LoadtabFile();
        };

        function LoadWikiFile() { //重新加载当前目录下的内容
            var re = new RegExp('-', 'g');
            $("#A" + wikiID.replace(re, '')).empty();

            $.post("getFileDirectory", {
                WikiId: wikiID
            }, function (list) {
                var re = new RegExp('-', 'g');
                var level = list.total;
                level = level * 0.6;
                list.forEach(function (value, index, list) {
                    $("#A" + wikiID.replace(re, '')).append("<li class='nav-item' href='#A" + value.id.replace(re, '') + "' data-toggle='collapse' aria-expanded='false' data-nodeid='" + value.id + "' onclick='Nodeclick(this)'><a><p style='text-indent: " + level.toString() + "em;margin-bottom: 0.6em;'><i class='bi-briefcase' style='padding-right: 4px;color: #007bff;'></i>" + value.fileName + "</p></a></li>");
                    $("#A" + wikiID.replace(re, '')).append("<ul class='collapse list-unstyled' id='A" + value.id.replace(re, '') + "'></ul>");
                });
            });
        };

        function LoadtabFile() {
            $('#tabFile').bootstrapTable('destroy'); // 这行代码必须加，否则数据无法刷新
            var columns = [{ field: "id", visible: false }, { field: "fileName"}, { field: "fileNumber" },
            { field: "year"}, { field: "version", formatter: SetVersion}, { field: "revise", formatter: SetRevise},
            { field: "draftedBy" }, { field: "draftedDate"}, { field: "effectiveDate", formatter: SetEffectivedate},
            { field: "creatorName"}, { field: "creatorTime", formatter: setRecordTime},
            { field: "changeContent", width: "6%", formatter: setChangeContent }, { field: "attachment", width: "6%", formatter: setAttachment }];

            $('#tabFile').bootstrapTable({
                method: 'post',
                url: "getWikiFiles",
                dataType: "json",  // 服务器端返回值类型
                contentType: "application/x-www-form-urlencoded; charset=UTF-8", // 如果是 POST 请求，这个属性必须加
                queryParams: function (params) {
                    var data = {
                        DirectoryId: wikiID,
                        limit: params.limit, // 每页显示多少条记录
                        offset: params.offset // 偏移量
                    };
                    return data;
                },
                queryParamsType: "limit", // 服务器端分页，这个参数必需是“limit”
                dataField: "rows",

                uniqueId: "id",          // 设置主键
                sidePagination: "server", // 服务器端分页，这个参数必需设置
                pagination: true,  // 显示分页条,设为true，启用了分页功能
                pageNumber: 1,
                pageSize: 20,   // 默认页大小
                pageList: [20, 50, 100],  // 控制每页数目
                locale: "zh-CN",
                columns: columns,          // 加载列定义, 注意！这个地方绑定的列名称开头大写字母会全部变成小写。
                silent: true,  //刷新事件必须设置
                onClickRow: function (row, $element, field) {
                    $("#tabFile").find("tbody").find("tr").each(function () {
                        $(this).removeClass('changeblueColor');
                    });
                    $element.addClass("changeblueColor");
                },
                formatLoadingMessage: function () {
                    return "请稍等，正在加载中...";
                },
                formatNoMatches: function () {  //没有匹配的结果
                    return '无符合条件的记录';
                },
                onLoadError: function (data) {
                    $('#tabFile').bootstrapTable('removeAll');
                },
                onLoadSuccess: function (data) {   // 数据加载成功后触发该事件
                    SetBootstrapStyle();
                    $('.TimePicker').datetimepicker({
                        timepicker: false,
                        format: "Y/m/d",
                        setLocale: 'zh'
                    });
                },
                formatShowingRows: function (pageFrom, pageTo, totalRows) {
                    return "正在显示第" + pageFrom + "到第" + pageTo + "条记录，总共" + totalRows + "条记录 ";
                },
                formatRecordsPerPage: function (pageNumber) {
                    return " 每页显示" + pageNumber + '条记录';
                }
            });
        }

        function SetVersion(value, row, index) {
            var text = value == null ? '' : value;
            var strHtml = "<input class='table-cell-input' data-Id=" + row.id + "  onchange='UpdateVersion(this)' value='" + text + "'/>";
            return strHtml;
        }

        function SetRevise(value, row, index) {
            var text = value == null ? '' : value;
            var strHtml = "<input class='table-cell-input' data-Id=" + row.id + "  onchange='UpdateRevise(this)' value='" + text + "'/>";
            return strHtml;
        }

        function SetEffectivedate(value, row, index) {
            var text = value == null ? '' : value;
            var strHtml = "<input class='TimePicker table-cell-input' data-Id=" + row.id + "  onchange='UpdateEffectiveDate(this)' value='" + text + "'/>";
            return strHtml;
        }

        function UpdateVersion(obj) {
            var st = $(obj).val();
            $.post("UpdateWikiFileVersion", {
                Id: $(obj.outerHTML).attr("data-Id"),
                Version: st
            }, function (data) {
                if (data.indexOf("成功") <= 0) {
                    alert(data);
                }
            });
        }

        function UpdateRevise(obj) {
            var st = $.trim($(obj).val());
            if (st.length > 50)
                alert("字符串长度不能超过50，多出部分将自动被截取！");

            $.post("UpdateWikiFileRevise", {
                Id: $(obj.outerHTML).attr("data-Id"),
                Revise: st
            }, function (data) {
                if (data.indexOf("成功") <= 0) {
                    alert(data);
                }
            });
        }

        function UpdateEffectiveDate(obj) {
            var st = $(obj).val();
            $.post("UpdateWikiFileEffectiveDate", {
                Id: $(obj.outerHTML).attr("data-Id"),
                EffectiveDate: st
            }, function (data) {
                if (data.indexOf("成功") <= 0) {
                    alert(data);
                }
            });
        }

        function setAttachment(value, row, index) {
            var strHtml = "<button class='table-cell-button menu-rfs' data-wikiFileId=" + row.id + " onclick='TableCellButton(this)'><i class='bi-file-pdf' style='color: #007bff;'></i></button>";
            return strHtml;
        }

        function setChangeContent(value, row, index) {
            var strHtml = "<button class='table-cell-button menu-rfs' data-textId=" + row.id + " onclick='UpdateChangeContent(this)'><i class='bi-file-text' style='color: #007bff;'></i></button>";
            return strHtml;
        }

        function UpdateChangeContent(obj) {
            $("#WikiFManager-comTitle").text("修订内容管理");

            $("#WikiFManager-comModal").modal({
                backdrop: 'static',
                keyboard: false
            });

            $.post("/Common/EditTextContent", {
                Domain: "WikiFileText",
                DomainId: $(obj.outerHTML).attr("data-textId"),
                ModalID: "WikiFManager-comModal"
            }, function (data) {
                $("#WikiFManager-comEmbed").html(data);
            });
        }

        function TableCellButton(obj) {
            $("#WikiFManager-comTitle").text("上传文件");

            $("#WikiFManager-comModal").modal({
                backdrop: 'static',
                keyboard: false
            });

            $.post("/Common/ManageFile", {
                Domain: "WikiFile",
                DomainId: $(obj.outerHTML).attr("data-wikiFileId"),
                ModalID: "WikiFManager-comModal"
            }, function (datas) {
                $("#WikiFManager-comEmbed").html(datas);
            });
        }

        function setRecordTime(value, row, index) {
            return row.creatorTime.replace('T', ' ').split(' ')[0];
        }

        $("#WikiFManager-AddDirectory").click(function() {
            if (wikiID.length == 0) {
                alert("请选择有效位置！");
                return;
            }

            $.post("SearchFileDirectory", {
                FileId: wikiID
            }, function (data) {
                if (data.length == 0) {
                    alert("请选择有效位置！");
                } else {
                    $("#WikiFManager-Modal-Title").text("添加目录");
                    $("#WikiFManager-AddDirectory-Current").val(data);
                    $("#WikiFManager-AddDirectory-Name").val(null);

                    $("#WikiFManager-Modal").modal({
                        backdrop: 'static',
                        keyboard: false
                    });
                    $("#WikiFManager-Modal-AddWiki").css('display', 'none');
                    $("#WikiFManager-Modal-AddDirectory").css('display', 'block');
                    $("#WikiFManager-Modal-tabFile").css('display', 'none');
                    $("#WikiFManager-Modal-AddPage").css('display', 'none');
                }
            });
        });

        $("#Modal-AddDirectory-confirm").click(function () {
            $.post("AddFileDirectory", {
                ParentDirectory: wikiID,
                DirectoryName: $("#WikiFManager-AddDirectory-Name").val()
            }, function (data) {
                if (data.indexOf("成功") >= 0) {
                    $("#Modal-AddDirectory-cancel").click();
                    LoadWikiFile();
                } else {
                    alert(data);
                }
            });
        });

        $("#WikiFManager-AddTopDirectory").click(function () {
            $("#WikiFManager-Modal-Title").text("添加文件分类");

            $("#WikiFManager-Modal").modal({
                backdrop: 'static',
                keyboard: false
            });
            $("#WikiFManager-Modal-AddWiki").css('display', 'block');
            $("#WikiFManager-Modal-AddDirectory").css('display', 'none');
            $("#WikiFManager-Modal-tabFile").css('display', 'none');
            $("#WikiFManager-Modal-AddPage").css('display', 'none');
        });

        $("#WikiFManager-AddTopDirectory-confirm").click(function () {
            var name = $("#WikiFManager-Modal-WikiName").val().replace(/[\s]/g, '');
            if (name.length == 0) {
                alert("名称不能为空！");
                return;
            }

            $.post("AddFileDirectory", {
                DirectoryName: name
            }, function (data) {
                if (data.indexOf("成功") >= 0) {
                    $("#WikiFManager-Modal").modal('hide');
                    $("#WikiTree").empty();
                    LoadWikis();
                } else {
                    alert(data);
                }
            });
        });

        $("#WikiFManager-AddFile").click(function () {
            if (wikiID.length == 0) {
                alert("请选择有效位置！");
                return;
            }
            
            $.post("SearchFileDirectory", {
                FileId: wikiID
            }, function (data) {
                if (data.length == 0) {
                    alert("请选择有效位置！");
                } else {
                    $("#WikiFManager-Modal-Title").text("新建文件");
                    $("#WikiFManager-AddFile-Current").val(data);
                    $("#WikiFManager-AddFile-Title").val(null);

                    $("#WikiFManager-Modal").modal({
                        backdrop: 'static',
                        keyboard: false
                    });
                    $("#WikiFManager-Modal-AddWiki").css('display', 'none');
                    $("#WikiFManager-Modal-AddDirectory").css('display', 'none');
                    $("#WikiFManager-Modal-tabFile").css('display', 'none');
                    $("#WikiFManager-Modal-AddPage").css('display', 'block');
                }
            });
        });

        $("#WikiFManager-AddFile-confirm").click(function () { //添加文件记录
            if ($.trim($("#WikiFManager-AddFile-Title").val()).length == 0) {
                alert("文件名不能为空！");
                $("#WikiFManager-AddFile-Title").addClass('error-style');
                return;
            }

            var jsonStr = {};
            jsonStr["ParentDirectory"] = wikiID;
            jsonStr["FileName"] = $.trim($("#WikiFManager-AddFile-Title").val());
            jsonStr["FileNumber"] = $.trim($("#WikiFManager-AddFile-FileNumber").val());
            jsonStr["Year"] = $.trim($("#WikiFManager-AddFile-Year").val());
            jsonStr["DraftedBy"] = $.trim($("#WikiFManager-AddFile-DraftedBy").val());
            jsonStr["DraftedDate"] = $.trim($("#WikiFManager-AddFile-DraftedDate").val());

            $.post("CreateWikiFile", {
                jsonStr: JSON.stringify(jsonStr)
            }, function (data) {
                if (data.indexOf("成功") >= 0) {
                    $("#WikiFManager-Modal").modal('hide');
                    LoadWikiFile();
                } else {
                    alert(data);
                }
            });
        });

        $("#WikiFManager-delFile").click(function () {
            var id = GetSelectIdByColor('tabFile').split(',')[0];
            if (id.length == 0) {
                alert("请先选择需要删除的文件记录！");
                return;
            }

            $("#DeleteConfirm-Modal").modal({
                backdrop: 'static',
                keyboard: false
            });
        });

        $("#DeleteConfirm-Modal-confirm").click(function () {
            var id = GetSelectIdByColor('tabFile').split(',')[0];
            $.post("DeleteWikiFile", {
                Id: id
            }, function (data) {
                if (data.indexOf("成功") >= 0) {
                    $('#tabFile').bootstrapTable('removeByUniqueId', id);
                    $("#DeleteConfirm-Modal").modal('hide');
                }
            });
        });

    </script>
}
